~ chicken-core (master) /manual/Module (chicken bytevector)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken bytevector)56This module contains procedures for dealing with "bytevectors",7fixed-size sequences of unsigned 8-bit integers.89=== bytevector1011<procedure>(bytevector FIXNUM ...)</procedure>1213Returns a new bytevector containing the values {{FIXNUM ...}}.1415=== make-bytevector1617<procedure>(make-bytevector SIZE)</procedure>1819Returns a bytevector object of {{SIZE}} bytes, aligned on an 8-byte boundary,20uninitialized.2122=== bytevector?2324<procedure>(bytevector? X)</procedure>2526Returns {{#t}} if {{X}} is a bytevector object, or27{{#f}} otherwise.2829=== bytevector-length3031<procedure>(bytevector-length BYTEVECTOR)</procedure>3233Returns the number of bytes in {{BYTEVECTOR}}.3435=== bytevector-u8-ref3637<procedure>(bytevector-u8-ref BYTEVECTOR INDEX)</procedure>3839Returns the byte at {{INDEX}} in {{BYTEVECTOR}}.4041=== bytevector-u8-set!4243<procedure>(bytevector-u8-set! BYTEVECTOR INDEX VALUE)</procedure>4445Destructively modifies the byte at {{INDEX}} in {{BYTEVECTOR}} to {{VALUE}}, which46should be a fixnum.4748=== utf8->string4950<procedure>(utf8->string BYTEVECTOR [START END])</procedure>5152Returns a string with the contents of {{BYTEVECTOR}}. Invalid encodings53for characters signal an error.5455<procedure>(bytes->string BYTEVECTOR [START END])</procedure>5657Similar to {{utf8->string}}, but accepts any byte sequence without58validating the contents. Byte-sequences that are not representing59valid UTF-8 characters are retained and, if extracted with {{string-ref}}60are converted to a trailing surrogate pair half in the range U+DC80 to U+DCFF.6162=== string->utf86364<procedure>(string->utf8 STRING)</procedure>6566Returns a bytevector with the contents of {{STRING}}.6768=== latin1->string6970<procedure>(latin1->string BYTEVECTOR)</procedure>7172Returns a string with the contents of {{BYTEVECTOR}} converted from Latin-1 (ISO-8859-1) encoding to UTF-8.7374=== string->latin17576<procedure>(string->latin1 STRING)</procedure>7778Returns a bytevector with the contents of {{STRING}} encoded as Latin-1 (ISO-?8859-1).7980=== bytevector=?8182<procedure>(bytevector=? BYTEVECTOR1 BYTEVECTOR2)</procedure>8384Returns {{#t}} if the two argument bytevectors are of the same85size and have the same content.8687=== bytevector-append8889<procedure>(bytevector-append BYTEVECTOR ...)</procedure>9091Returns a new bytevector holding the concatenated contents of all92argument bytevectors.9394=== bytevector-copy9596<procedure>(bytevector-copy BYTEVECTOR #!optional START END)</procedure>9798Returns a new bytevector holding the contents of {{BYTEVECTOR}} between99the indices {{START}} to {{END}}.100101=== bytevector-copy!102103<procedure>(bytevector-copy! TO AT FROM #!optional START END)</procedure>104105Copioes the contents of the bytevector FROM between106the indices {{START}} to {{END}} into the bytevector {{TO}}, starting at107index {{AT}}.108109110---111Previous: [[Module (chicken bitwise)]]112113Next: [[Module (chicken condition)]]114115